package cn.stylefeng.guns.modular.demo.controller.convert;

import cn.stylefeng.guns.dao.entity.Goods;
import cn.stylefeng.guns.modular.demo.controller.domain.GoodsVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.Objects;

@Mapper(componentModel = "spring")
public interface GoodsConverter {
    GoodsVO convert(Goods goods);


    default Double parsePrice(Integer price) {
        if (Objects.isNull(price)) {
            return 0D;
        }
        return price / 100D;
    }


}
